package org.bibeault.jqia2.control.autocompleter;

import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class MovieListServlet extends HttpServlet {

  private static final String[] MOVIES = new String[]{
      "009-1, Disc 1",
      "009-1, Disc 2",
      "12 Monkeys",
      "20 Million Miles to Earth",
      "20,000 Leagues Under the Sea, Special Edition",
      "2010: The Year We Make Contact",
      "48 Hours",
      "A Beautiful Mind",
      "A Bug's Life",
      "A Caribbean Mystery (Helen Hayes)",
      "A Carribean Mystery (Joan Hickson)",
      "A Charlie Brown Christmas",
      "A Christmas Carol (George C. Scott)",
      "A Christmas Carol, (Patrick Stewart)",
      "A Christmas Story",
      "A Clear and Present Danger",
      "A Clockwork Orange",
      "A Fish Called Wanda",
      "A Murder is Announced (Geraldine McEwan)",
      "A Murder is Announced, (Joan Dickson)",
      "A Pocketful of Rye (Joan Dickson)",
      "A Sound of Thunder",
      "A Wish For Wings That Work",
      "A Year in Provence, Disc 1",
      "A Year in Provence, Disc 2",
      "ABBA: The Definitive Collection",
      "ABBA: The Winner Takes It All",
      "Aeon Flux",
      "Aeon Flux: Volume 1",
      "Aeon Flux: Volume 2",
      "Aeon Flux: Volume 3",
      "Akira",
      "Alien",
      "Alien Planet",
      "Alien vs. Predator",
      "Alien vs. Predator Requiem ",
      "Aliens",
      "All of Me",
      "Amadeus",
      "America's Test Kitchen, Volume 1",
      "America's Test Kitchen, Volume 10",
      "America's Test Kitchen, Volume 11",
      "America's Test Kitchen, Volume 12",
      "America's Test Kitchen, Volume 13",
      "America's Test Kitchen, Volume 2",
      "America's Test Kitchen, Volume 3",
      "America's Test Kitchen, Volume 4",
      "America's Test Kitchen, Volume 5",
      "America's Test Kitchen, Volume 6",
      "America's Test Kitchen, Volume 7",
      "America's Test Kitchen, Volume 8",
      "America's Test Kitchen, Volume 9",
      "An American Christmas Carol",
      "Anatomy of a Murder",
      "And Then There Were None",
      "And the Band Played On",
      "Animal Farm",
      "Annie Hall",
      "Another Thin Man",
      "Antz",
      "Apollo 13",
      "Arsenic and Old Lace",
      "Arthur",
      "At Bertram's Hotel, Joan Hickson",
      "Atragon",
      "Austin Powers: The Spy Who Shagged Me",
      "Avatar, Disc 1",
      "Avatar, Disc 2",
      "Avatar, Disc 3",
      "Avatar, Disc 4",
      "Avatar, Disc 5",
      "Babylon 5: The Gathering",
      "Barefoot Contessa, Volume 1",
      "Barefoot Contessa, Volume 2",
      "Barefoot Contessa, Volume 3",
      "Barefoot Gen, Movies 1 and 2",
      "Batman",
      "Batman Begins",
      "Batman Beyond, Season 1, Disk 1",
      "Batman Beyond, Season 1, Disk 2",
      "Batman Beyond, Season 2, Disk 1",
      "Batman Beyond, Season 2, Disk 2",
      "Batman Beyond, Season 2, Disk 3",
      "Batman Beyond, Season 2, Disk 4",
      "Batman Beyond, Season 3, Disc 1",
      "Batman Beyond, Season 3, Disc 2",
      "Batman Beyond: Return of the Joker",
      "Batman Forever",
      "Batman and Mr. Freeze",
      "Batman and Robin",
      "Batman, The Animated Series: The Legend Begins",
      "Batman, The Animated Series, Season 1, Volume 1",
      "Batman, The Animated Series, Season 1, Volume 2",
      "Batman, The Animated Series, Season 1, Volume 3",
      "Batman, The Animated Series, Season 1, Volume 4",
      "Batman, The Animated Series, Season 2, Volume 1",
      "Batman, The Animated Series, Season 2, Volume 2",
      "Batman, The Animated Series, Season 2, Volume 3",
      "Batman, The Animated Series, Season 2, Volume 4",
      "Batman, The Animated Series, Season 3, Volume 1",
      "Batman, The Animated Series, Season 3, Volume 2",
      "Batman, The Animated Series, Season 3, Volume 3",
      "Batman, The Animated Series, Season 3, Volume 4",
      "Batman, The Animated Series, Season 4, Volume 1",
      "Batman, The Animated Series, Season 4, Volume 2",
      "Batman, The Animated Series, Season 4, Volume 3",
      "Batman, The Animated Series, Season 4, Volume 4",
      "Batman: Mask of the Phantasm",
      "Batman: Mystery of the Batwoman",
      "Battlestar Galactica, Season 1",
      "Battlestar Galactica, Season 2.0",
      "Battlestar Galactica, Season 2.5",
      "Battlestar Galactica: The Mini-series",
      "Bear Cub",
      "Beowulf",
      "Beverly Hills Cop",
      "Beverly Hills Cop 2",
      "Biloxi Blues",
      "Black Widow",
      "Blade Runner (Director's Cut)",
      "Blade Runner (Final version)",
      "Blood: The Last Vampire",
      "Body Heat",
      "Boot Dreams",
      "Boot Therapy",
      "Bram Stoker's Dracula",
      "Brazil",
      "Brazil, Love Conquers All Edition",
      "Bride of Frankenstein",
      "Brokeback Mountain",
      "Brother Bear",
      "Bubblegum Crisis, Volume 1",
      "Bubblegum Crisis, Volume 2",
      "Bubblegum Crisis, Volume 3",
      "By the Pricking of my Thumbs (Geraldine McEwan)",
      "Capote",
      "Cars",
      "Casablanca",
      "Case Closed, Season 4, Disc 1",
      "Case Closed, Season 4, Disc 2",
      "Case Closed, Season 4, Disc 3",
      "Case Closed, Season 4, Disc 4",
      "Case Closed, Season 4, Disc 5",
      "Case Closed, Season 5, Disc 1",
      "Case Closed, Season 5, Disc 2",
      "Case Closed, Season 5, Disc 3",
      "Case Closed, Season 5, Disc 4",
      "Case Closed, Season 5, Disc 5",
      "Castle in the Sky",
      "Charlie and the Chocolate Factory",
      "Chicken Run",
      "Children of Dune",
      "Children of Men",
      "Christmas Vacation",
      "Clash of the Titans",
      "Cloverfield",
      "Clue",
      "Cocoon",
      "Coma",
      "Communion",
      "Cosmos: Carl Sagan",
      "Courage the Cowardly Dog, Volume 1",
      "Courage the Cowardly Dog, Volume 2",
      "Cowboy Bebop, Extras",
      "Cowboy Bebop, Volume 1",
      "Cowboy Bebop, Volume 2",
      "Cowboy Bebop, Volume 3",
      "Cowboy Bebop, Volume 4",
      "Cowboy Bebop, Volume 5",
      "Cowboy Bebop, Volume 6, plus Movie",
      "Creature Comforts, Season 1",
      "Cricket on the Hearth",
      "Crimson Tide",
      "Crouching Tiger, Hidden Dragon",
      "Cruising",
      "Cyborg 009, Disc 1",
      "Cyborg 009, Disc 2",
      "Dangerous Liasons (fullscreen)",
      "Dangerous Liasons (widescreen)",
      "Dark City",
      "Dark Fury",
      "Darkman",
      "Dave",
      "Dead Man's Folly",
      "Death Wish",
      "Defending Your Life",
      "Deliverance",
      "Dial M for Murder",
      "Diamonds Are Forever",
      "Die Mommie Die",
      "Dilbert, Disc 1",
      "Dilbert, Disc 2",
      "Dilbert, Disc 3",
      "Dilbert, Disc 4",
      "Doctor Strange",
      "Dolores Claiborne",
      "Doom",
      "Dr. Katz Professional Therapist, Season 1",
      "Dr. Katz Professional Therapist, Season 2",
      "Dr. No",
      "Dracut Video Test",
      "Dragonheart",
      "Dragons",
      "Dragonslayer",
      "Dune",
      "Dune, Extended Edition",
      "East of Eden",
      "Eating Raoul",
      "Eddie Izzard: Circle",
      "Eddie Izzard: Definite Article",
      "Eddie Izzard: Dress to Kill",
      "Eddie Izzard: Glorious",
      "Eddie Izzard: Je Suis un Standup",
      "Eddie Izzard: Unpredictable",
      "Eight Legged Freaks",
      "Einstein's Big Idea",
      "El Hazard, Disc 1",
      "El Hazard, Disc 2",
      "El Hazard, Disc 3",
      "El Hazard, Disc 4",
      "Election",
      "Elfin Lied, Disc 1",
      "Elfin Lied, Disc 2",
      "Elfin Lied, Disc 3",
      "Elfin Lied, Disc 4",
      "Ellen Degeneres: Hear and Now",
      "Ellen: The Beginning",
      "Enemy Mine",
      "Equilibrium",
      "Eragon",
      "Erin Brockovich",
      "Eureka 7, Disc 1",
      "Eureka 7, Disc 2",
      "Eureka 7, Disc 3",
      "Everything",
      "Exodus",
      "Extremities (16:9)",
      "Extremities (4:3)",
      "FX",
      "Fahrenheit 451",
      "Family Guy, Volume One, Seasons 1 and 2",
      "Family Plot",
      "Fantastic Four (1994), Disc 1",
      "Fantastic Four (1994), Disc 2",
      "Fantastic Four (1994), Disc 3",
      "Fantastic Four (1994), Disc 4",
      "Fantastic Planet",
      "Fantastic Voyage",
      "Fargo",
      "Farscape, Season 1, Volume 1",
      "Farscape, Season 1, Volume 2",
      "Farscape, Season 1, Volume 3",
      "Farscape, Season 1, Volume 4",
      "Farscape, Season 1, Volume 5",
      "Farscape, Season 1, Volume 6",
      "Farscape, Season 1, Volume 7",
      "Farscape, Season 2, Volume 1",
      "Farscape, Season 2, Volume 2",
      "Farscape, Season 2, Volume 3",
      "Farscape, Season 2, Volume 4",
      "Farscape, Season 2, Volume 5",
      "Farscape, Season 2, Volume 6",
      "Farscape, Season 2, Volume 7",
      "Farscape, Season 2, Volume 8",
      "Farscape, Season 3, Volume 1",
      "Farscape, Season 3, Volume 2",
      "Farscape, Season 3, Volume 3",
      "Farscape, Season 3, Volume 4",
      "Farscape, Season 3, Volume 5",
      "Farscape, Season 3, Volume 6",
      "Farscape, Season 3, Volume 7",
      "Farscape, Season 3, Volume 8",
      "Farscape, Season 4, Volume 1",
      "Farscape, Season 4, Volume 2",
      "Farscape, Season 4, Volume 3",
      "Farscape, Season 4, Volume 4",
      "Farscape, Season 4, Volume 5",
      "Farscape, Season 4, Volume 6",
      "Farscape, Season 4, Volume 7",
      "Farscape, Season 4, Volume 8",
      "Feasting on Asphalt, Season 1",
      "Final Fantasy: The Spirits Within",
      "Finding Nemo",
      "Firefly, Season 1, Extras",
      "Firefly, Season 1, Volume 1",
      "Firefly, Season 1, Volume 2",
      "Firefly, Season 1, Volume 3",
      "Firefly, Season 1, Volume 4",
      "Firefly, Season 1, Volume 5",
      "First Monday in October",
      "Flashdance",
      "Fletch",
      "Fletch Lives",
      "Flushed Away",
      "Flyboys",
      "For Pete's Sake",
      "Forbidden Planet",
      "Foyle's War, Season 1, Disc 1",
      "Foyle's War, Season 1, Disc 2",
      "Foyle's War, Season 1, Disc 3",
      "Foyle's War, Season 1, Disc 4",
      "Foyle's War, Season 2, Disc 1",
      "Foyle's War, Season 2, Disc 1",
      "Foyle's War, Season 2, Disc 2",
      "Foyle's War, Season 2, Disc 2",
      "Foyle's War, Season 2, Disc 3",
      "Foyle's War, Season 2, Disc 3",
      "Foyle's War, Season 2, Disc 4",
      "Foyle's War, Season 2, Disc 4",
      "Foyle's War, Season 2, Disc 4",
      "Frankenstein",
      "Frenzy",
      "From Russia With Love",
      "Frosty Returns",
      "Frosty the Snowman",
      "Full Metal Alchemist: Conqueror of Shamballa",
      "Funny Girl",
      "Galaxy Quest",
      "Gattica",
      "Ghost Story",
      "Ghost in the Shell",
      "Ghost in the Shell 2: Innocence",
      "Ghost in the Shell, Standalone Complex, Complete First Season",
      "Ghost in the Shell: Standalone Complex, 2nd Gig, Volume 1",
      "Ghost in the Shell: Standalone Complex, 2nd Gig, Volume 2",
      "Ghost in the Shell: Standalone Complex, 2nd Gig, Volume 3",
      "Ghost in the Shell: Standalone Complex, 2nd Gig, Volume 4",
      "Ghost in the Shell: Standalone Complex, 2nd Gig, Volume 5",
      "Ghost in the Shell: Standalone Complex, 2nd Gig, Volume 6",
      "Ghost in the Shell: Standalone Complex, 2nd Gig, Volume 7",
      "Ghosts of the Abyss",
      "Gladiator",
      "Gojira",
      "Gojira Extras",
      "Goldfinger",
      "Goldmember",
      "Good Eats Takeout Collection: All American Greats",
      "Good Eats Takeout Collection: Breakfast Eats",
      "Good Eats Takeout Collection: Holiday Treats",
      "Good Eats Takeout Collection: Hooked and Cooked",
      "Good Eats Takeout Collection: Juicy Meats",
      "Good Eats Takeout Collection: More Juicy Meats",
      "Good Eats Takeout Collection: Poultry Pleasers",
      "Good Eats Takeout Collection: Super Sweets",
      "Good Eats Takeout Collection: Super Sweets 2",
      "Goodnight and Good Luck",
      "Gotcha",
      "Grave of the Fireflies",
      "Greater Tuna",
      "Happy Feet",
      "Harry Potter and the Chamber of Secrets",
      "Harry Potter and the Order of the Phoenix",
      "Harry Potter and the Prisoner of Azkaban",
      "Harry Potter and the Sorceror's Stone",
      "Hawaii",
      "Hellsing, Volume 1",
      "Hellsing, Volume 2",
      "Hellsing, Volume 3",
      "Hellsing, Volume 4",
      "Highlander, 10th Anniversary Director's Cut",
      "Hitman",
      "Home Movies, Season 1, Disk 1",
      "Home Movies, Season 1, Disk 2",
      "Home Movies, Season 1, Disk 3",
      "Home Movies, Season 2, Disk 1",
      "Home Movies, Season 2, Disk 2",
      "Home Movies, Season 2, Disk 3",
      "Home Movies, Season 3, Disk 1",
      "Home Movies, Season 3, Disk 2",
      "Home Movies, Season 3, Disk 3",
      "Home Movies, Season 4, Disk 1",
      "Home Movies, Season 4, Disk 2",
      "Home Movies, Season 4, Disk 3",
      "Hot Rod",
      "How the Grinch Stole Christmas",
      "How the Grinch Stole Christmas, 2000",
      "Howl's Moving Castle",
      "Hyperspace",
      "I, Robot",
      "Ice Age",
      "Ice Age 2",
      "Ice Castles",
      "Idiocracy",
      "In a Mirror Darkly, Parts 1 and 2",
      "Independence Day",
      "Indiana Jones and the Kingdonw of the Crystal Skull",
      "Indiana Jones and the Last Crusade",
      "Indiana Jones and the Raiders of the Lost Ark",
      "Indiana Jones and the Temple of Doom",
      "Into the Night",
      "Inuyasha: Affections Touching Across Time",
      "Inuyasha: Fire on the Mystic Island",
      "Inuyasha: The Castle Beyond the Looking Glass",
      "Inuyashi: Swords of an Honorable Ruler",
      "It's a Bug's Life Extras",
      "It's the Great Pumpkin, Charlie Brown",
      "Jackass: The Movie",
      "Jackie Brown",
      "Jagged Edge",
      "Jeffrey",
      "Jonny Quest: The Complete First Season",
      "Jurassic Park",
      "Jurassic Park 2: The Lost World",
      "Jurassic Park 3",
      "Justice League, Season 1, Disc 1",
      "Justice League, Season 1, Disc 2",
      "Justice League, Season 1, Disc 3",
      "Justice League, Season 1, Disc 4",
      "Justice League, Season 2, Disc 1",
      "Justice League, Season 2, Disc 2",
      "Justice League, Season 2, Disc 3",
      "Justice League, Season 2, Disc 4",
      "Justice League: New Frontier",
      "Justice League: New Frontier Extra Features",
      "K-PAX",
      "Key Largo",
      "Kiki's Delivery Service",
      "Kill Bill, Volume 1",
      "Kill Bill, Volume 2",
      "King Kong, 1933",
      "Kolchak: The Night Stalker, Volume 1",
      "Kolchak: The Night Stalker, Volume 2",
      "Kolchak: The Night Stalker, Volume 3",
      "Kolchak: The Night Stalker, Volume 4",
      "Kolchak: The Night Stalker, Volume 5",
      "La Femme Nikita",
      "Lady in the Water",
      "Ladyhawk",
      "Lain, Disc 1",
      "Lain, Disc 2",
      "Lain, Disc 3",
      "Lain, Disc 4",
      "Les Miserables",
      "Life in the Undergrowth, Disc 1",
      "Life in the Undergrowth, Disc 2",
      "Little Britain, Live",
      "Little Britain, Season 1, Disc 1",
      "Little Britain, Season 1, Disc 2",
      "Little Britain, Season 2, Disc 1",
      "Little Britain, Season 2, Disc 2",
      "Little Britain, Season 3, Disc 1",
      "Little Britain, Season 3, Disc 2",
      "Live Free or Die Hard",
      "Longtime Companion",
      "Lord of the Rings: The Fellowship of the Ring",
      "Lord of the Rings: The Return of the King",
      "Lord of the Rings: The Two Towers",
      "Lost in Space: The Complete First Season, Volume 1",
      "Lost in Space: The Complete First Season, Volume 2",
      "Lost in Space: The Complete First Season, Volume 3",
      "Lost in Space: The Complete First Season, Volume 4",
      "Lost in Space: The Complete First Season, Volume 5",
      "Lost in Space: The Complete First Season, Volume 6",
      "Lost in Space: The Complete First Season, Volume 7",
      "Lost in Space: The Complete First Season, Volume 8",
      "M.A.S.H.",
      "Madagascar",
      "Magnetic Storm",
      "Making the Earth Stand Still",
      "Malice@Doll",
      "Man on Fire",
      "Marnie",
      "Masterpiece Theatre: Dracula",
      "Matrix Revolutions",
      "Memento",
      "Memoirs of a Geisha",
      "Men in Black II",
      "Metropolis, 2001",
      "Mexico: One Plate at a Time, Volume 1",
      "Mexico: One Plate at a Time, Volume 2",
      "Mexico: One Plate at a Time, Volume 3",
      "Mexico: One Plate at a Time, Volume 4",
      "Mighty Joe Young",
      "Millenium Actress",
      "Mind Meld",
      "Minority Report",
      "Mission Hill, Season 1, Volume 1",
      "Mission Hill, Season 1, Volume 2",
      "Mission to Mars",
      "Mister Roberts",
      "Monsters, Inc.",
      "Monty Python and the Holy Grail",
      "Monty Pythons' Flying Circus: Season 4",
      "Mr. Magoo's Christmas Carol",
      "Murder at the Gallop",
      "Murder at the Vicarage, Geraldine McEwan",
      "Murder at the Vicarage, Joan Dickson",
      "Murder in Three Acts",
      "Murder is Easy",
      "Murder on the Orient Express",
      "Murder on the Orient Express (TV version)",
      "Murder with Mirrors",
      "Muriel's Wedding",
      "My Big Fat Greek Wedding",
      "My Neighbor Totoro",
      "Mysterious Island",
      "Mystery Men",
      "Nancy Drew",
      "Napoleon Dynamite",
      "Naussicaa of the Valley of the Wind",
      "Nemesis, Joan Dickson",
      "Neon Genesis Evangelion, Volume 1",
      "Neon Genesis Evangelion, Volume 2",
      "Neon Genesis Evangelion, Volume 3",
      "Neon Genesis Evangelion, Volume 4",
      "Neon Genesis Evangelion, Volume 5",
      "Neon Genesis Evangelion, Volume 6",
      "Neon Genesis Evangelion, Volume 7",
      "Neon Genesis Evangelion, Volume 8",
      "Neverending Story",
      "Night Gallery, Season 1, Volume 1",
      "Night Gallery, Season 1, Volume 2",
      "Night Gallery, Season 1, Volume 3",
      "No Way Out",
      "Noble House, Disc 1 of 2",
      "Noble House, Disc 2 of 2",
      "North by Northwest",
      "Nosferatu",
      "Notorious",
      "Nova: The Unknown World",
      "Ocean's Eleven",
      "Office Space",
      "On A Clear Day You Can See Forever",
      "On Her Majesty's Secret Service",
      "Once Upon a Time in Mexico",
      "Origins, Disc 1",
      "Origins, Disc 2",
      "Outland (fullscreen)",
      "Outland (widescreen)",
      "Over the Hedge",
      "Over the Hedge, Extras",
      "Over the Top",
      "Pan's Labyrinth",
      "Paprika",
      "Pearl Harbor, The Director's Cut",
      "Pirates of the Caribbean: Dead Man's Chest",
      "Pitch Black",
      "Planet of the Apes, 2001",
      "Point of No Return",
      "Poirot: A Poirot Christmas",
      "Poirot: After the Funeral",
      "Poirot: Cards on the Table",
      "Poirot: Death in the Clouds",
      "Poirot: Death on the Nile",
      "Poirot: Dumb Witness",
      "Poirot: Five Little Pigs",
      "Poirot: Hickory Dickory Dock",
      "Poirot: Lord Edgeware Dies",
      "Poirot: Murder in Mesopotamia",
      "Poirot: Murder on the Links",
      "Poirot: One, Two, Buckle My Shoe",
      "Poirot: Peril at End House",
      "Poirot: Sad Cypress",
      "Poirot: Taken at the Flood",
      "Poirot: The ABC Murders",
      "Poirot: The Hollow",
      "Poirot: The Murder of Roger Ackroyd",
      "Poirot: The Mysterious Affair at Styles",
      "Poirot: The Mystery of the Blue Train",
      "Poirot: Volume 1",
      "Poirot: Volume 10",
      "Poirot: Volume 11",
      "Poirot: Volume 12",
      "Poirot: Volume 2",
      "Poirot: Volume 3",
      "Poirot: Volume 4",
      "Poirot: Volume 5",
      "Poirot: Volume 6",
      "Poirot: Volume 7",
      "Poirot: Volume 8",
      "Poirot: Volume 9",
      "Police Academy",
      "Poltergeist",
      "Porco Rosso",
      "Postcards from the Edge",
      "Princess Mononoke",
      "Psycho",
      "Pulp Fiction",
      "Raising Arizona",
      "Read or Die",
      "Read or Die the TV, Volume 1",
      "Read or Die the TV, Volume 2",
      "Read or Die the TV, Volume 3",
      "Read or Die the TV, Volume 4",
      "Read or Die the TV, Volume 5",
      "Rear Window",
      "Red Dragon",
      "Red Planet",
      "Regarding Henry",
      "Remembering the Carpenters",
      "Resevoir Dogs",
      "Robin Williams: Live on Broadway",
      "Robocop",
      "Robocop 2",
      "Robots",
      "Rope",
      "Rudolph the Red-nosed Reindeer",
      "Ruthless People",
      "S-Cry-Ed, Season 1, Volume 1",
      "S-Cry-Ed, Season 1, Volume 2",
      "S-Cry-Ed, Season 1, Volume 3",
      "Saboteur",
      "Sakura Wars",
      "Samurai 7, Disc 1",
      "Samurai 7, Disc 2",
      "Samurai 7, Disc 3",
      "Samurai 7, Disc 4",
      "Samurai 7, Disc 5",
      "Samurai 7, Disc 6",
      "Samurai 7, Disc 7",
      "Samurai 7, Disc 7",
      "Samurai Jack, Movie",
      "Samurai Jack, Volume 1",
      "Samurai Jack, Volume 2",
      "Samurai Jack, Volume 3",
      "Samurai X, Director's Cut",
      "Santa Claus is Coming to Town",
      "Secret Agent",
      "Seems Like Old Times",
      "Seesaw, Disc 1",
      "Seesaw, Disc 2",
      "Serenity",
      "Sex, Lies and Videotape",
      "Shadow of the Thin Man",
      "Sherlock Holmes Faces Death",
      "Sherlock Holmes In Washington",
      "Sherlock Holmes: Dressed to Kill",
      "Sherlock Holmes: Pursuit to Algiers",
      "Sherlock Holmes: Terror by Night",
      "Sherlock Holmes: The Adentures of Sherlock Holmes",
      "Sherlock Holmes: The Adentures of Sherlock Holmes with Commentary",
      "Sherlock Holmes: The House of Fear",
      "Sherlock Holmes: The Pearl of Death",
      "Sherlock Holmes: The Scarlet Claw",
      "Sherlock Holmes: The Secret Weapon",
      "Sherlock Holmes: The Spider Woman",
      "Sherlock Holmes: The Voice of Terror",
      "Sherlock Holmes: The Woman in Green",
      "Sherlock Holmes: The Woman in Green with Commentary",
      "Shining Through",
      "Shogun, Extras",
      "Shogun, Part 1",
      "Shogun, Part 2",
      "Shogun, Part 3",
      "Shogun, Part 4",
      "Shrek",
      "Shrek 2",
      "Shrek 3",
      "Sideways",
      "Signs",
      "Silver Streak",
      "Sin City",
      "Sky Captain and the World of Tomorrow",
      "Sky Captain and the World of Tomorrow, Extras",
      "Slacker",
      "Sleeper",
      "Sleeping Murder (Geraldine McEwan)",
      "Sleeping Murder (Joan Hickson)",
      "Smokey and the Bandit",
      "Sneakers",
      "Solaris",
      "Solty Rei, Disc 1",
      "Solty Rei, Disc 2",
      "Solty Rei, Disc 3",
      "Solty Rei, Disc 4",
      "Sordid Lives",
      "South Park: Bigger, Longer and Uncut",
      "Space 1999: Volume 1",
      "Space 1999: Volume 2",
      "Space 1999: Volume 3",
      "Space 1999: Volume 4",
      "Speed",
      "Spider-man",
      "Spider-man 2",
      "Spirited Away",
      "Star Trek II: The Wrath of Khan",
      "Star Trek, The Complete Animated Series",
      "Star Trek, The Original Series, The Complete First Season",
      "Star Trek, The Original Series, The Complete Second Season",
      "Star Trek, The Original Series, The Complete Third Season",
      "Star Trek: Deep Space Nine, Season 1",
      "Star Trek: First Contact",
      "Star Trek: Generations",
      "Star Trek: Insurrection",
      "Star Trek: Nemesis",
      "Star Trek: The Next Generation, Season 1",
      "Star Trek: The Next Generation, Season 2",
      "Star Trek: The Next Generation, Season 3",
      "Star Trek: The Next Generation, Season 4",
      "Star Trek: The Next Generation, Season 5",
      "Star Trek: The Next Generation, Season 6",
      "Star Trek: The Next Generation, Season 7",
      "Star Trek: The original Series, Volume 18",
      "Star Wars I: The Phantom Menace",
      "Star Wars II: Attack of the Clones",
      "Star Wars III: The Revenge of the Sith",
      "Star Wars IV: A New Hope",
      "Star Wars V: The Empire Strikes Back",
      "Star Wars VI: Return of the Jedi",
      "Star Wars: A new Hope (Original Theatrical Release)",
      "Star Wars: Clone Wars, Vol. 1",
      "Star Wars: Clone Wars, Vol. 2",
      "Star Wars: Return of the Jedi (Original Theatrical Release)",
      "Star Wars: The Empire Strikes Back (Original Theatrical Release)",
      "Star Wars: The Phantom Menace",
      "Stardust",
      "Stargate SG-1: Season 1, Volume 1",
      "Stargate SG-1: Season 1, Volume 2",
      "Stargate SG-1: Season 1, Volume 3",
      "Stargate SG-1: Season 1, Volume 4",
      "Stargate SG-1: Season 1, Volume 5",
      "Stargate, Director's Cut",
      "Stargate, Extras",
      "Stevie: Live at Red Rock",
      "Stewie Griffin: The Untold Story",
      "Stranges on a Train",
      "Suckers",
      "Superman",
      "Superman 2, The Donner Cut",
      "Superman Doomsday",
      "Superman Extras",
      "Superman Returns",
      "Superman, The Animated Series, Season 1, Volume 1",
      "Superman, The Animated Series, Season 1, Volume 2",
      "Superman, The Animated Series, Season 1, Volume 3",
      "Superman, The Animated Series, Season 3, Volume 1",
      "Superman, The Animated Series, Season 3, Volume 2",
      "Superman, The Animated Series, Season 3, Volume 3",
      "Superman: Brainiac Attacks",
      "Surviving the Game",
      "Suspicion",
      "Sybil",
      "Syriana",
      "Taken, Extras",
      "Taken, Part 1",
      "Taken, Part 2",
      "Taken, Part 3",
      "Taken, Part 4",
      "Taken, Part 5",
      "Tales of the City, Part 1",
      "Tales of the City, Part 2",
      "Tatoo",
      "Team America: World Police",
      "Tenacious D in the Pick of Destiny",
      "Terminator 2: Judgement Day",
      "Terminator 3: Rise of the Machines",
      "The 40 Year Old Virgin",
      "The 4:50 from Paddington (Geraldine McEwan)",
      "The 4:50 from Paddington (Joan Hickson)",
      "The Abyss, Special Edition",
      "The Adventures of Baron Munchausen",
      "The Alamo",
      "The Amazing Screw-on Head",
      "The Animatrix",
      "The Avengers",
      "The Aviator",
      "The Bad Seed",
      "The Batman Beyond Movie",
      "The Batman Superman Movie",
      "The Beast",
      "The Beast from 20,000 Fathoms",
      "The Best of George Michael",
      "The Big O, Season 1, Volume 1",
      "The Big O, Season 1, Volume 2",
      "The Big O, Season 1, Volume 3",
      "The Big O, Season 1, Volume 4",
      "The Big O, Season 1, Volume 5",
      "The Big Sleep",
      "The Birds",
      "The Body in the Library (Geraldine McEwan)",
      "The Body in the Library (Joan Hickson)",
      "The Boondocks, Season 1, Volume 1",
      "The Boondocks, Season 1, Volume 2",
      "The Boondocks, Season 1, Volume 3",
      "The Bourne Identity",
      "The Bourne Supremacy",
      "The Bourne Ultimatum",
      "The Boys from Brazil",
      "The Brave One",
      "The Bridge on the River Kwai",
      "The Butcher Boy",
      "The Cat Returns",
      "The China Syndrome",
      "The Chronicles of Narnia",
      "The Chronicles of Riddick",
      "The Corpse Bride",
      "The Creature From the Black Lagoon",
      "The Critic, The Entire Season, Volume 1",
      "The Critic, The Entire Season, Volume 2",
      "The Critic, The Entire Season, Volume 3",
      "The Critic, The Entire Season, Volume 4",
      "The Crying Game",
      "The Da Vinci Code",
      "The Day After Tomorrow",
      "The Day of the Jackal",
      "The Day of the Triffids",
      "The Day the Earth Stood Still",
      "The Devil Wears Prada",
      "The Electric Horseman",
      "The Ellen Show, Season 1, Disk 1",
      "The Ellen Show, Season 1, Disk 2",
      "The Fantastic Four",
      "The Fast and the Furious",
      "The Fifth Element",
      "The First Men in the Moon",
      "The Flash, Season 1, Disk 1",
      "The Flash, Season 1, Disk 2",
      "The Flash, Season 1, Disk 3",
      "The Flash, Season 1, Disk 4",
      "The Flash, Season 1, Disk 5",
      "The Flash, Season 1, Disk 6",
      "The Flight of the Navigator",
      "The Flight of the Phoenix, 1965",
      "The Flight of the Phoenix, 2004",
      "The French Connection",
      "The Full Monty",
      "The Futurama Movie",
      "The Ghost and Mrs. Muir",
      "The Gods Must Be Crazy",
      "The Gods Must Be Crazy 2",
      "The Gods Must Be Crazy, Documentary",
      "The Great Escape",
      "The Great Train Robbery",
      "The Hitchhiker's Guide to the Galaxy",
      "The Hobbit",
      "The Hunt for Red October",
      "The Hunting Party",
      "The Incredible Adventures of Wallace and Gromit",
      "The Incredible Mr. Limpet",
      "The Incredibles",
      "The Invisible Man",
      "The Iron Giant, Speical Edition",
      "The Jackal",
      "The Lady Vanishes",
      "The Last Exile, Volume 1",
      "The Last Exile, Volume 2",
      "The Last Exile, Volume 3",
      "The Last Exile, Volume 4",
      "The Last Exile, Volume 5",
      "The Last Exile, Volume 6",
      "The Last Exile, Volume 7",
      "The League of Extraordinary Gentlemen",
      "The Legend of Boggy Creek",
      "The Little Drummer Boy",
      "The Maltese Falcon",
      "The Man Who Knew Too Much, 1934",
      "The Man Who Planted Trees, Disc 1",
      "The Man Who Planted Trees, Disc 2",
      "The Man Who Planted Trees, Disc 3",
      "The Man Who Planted Trees, Disc 4",
      "The Man in the Brown Suit",
      "The Man with One Red Shoe",
      "The Manchurian Candidate (1962)",
      "The Manuchurian Candidate (2004)",
      "The Martian Chronicles, Part 1",
      "The Martian Chronicles, Part 2",
      "The Martian Chronicles, Part 3",
      "The Matrix",
      "The Mirror Cracked, Joan Hickson",
      "The Mothman Prophecies",
      "The Moving Finger (Geraldine McEwan)",
      "The Moving Finger (Joan Hickson)",
      "The Mummy",
      "The Mummy Returns",
      "The Nightmare Before Christmas",
      "The Omen",
      "The Omen 666",
      "The Others",
      "The Outer Limits: The Original Series",
      "The Pacifier",
      "The Pale Horse",
      "The Peacekeeper Wars",
      "The Perfect Storm",
      "The Pink Panther",
      "The Pirates of Silicon Valley",
      "The Plague Dogs",
      "The Presidio",
      "The Prince and the Pauper",
      "The Princess Bride",
      "The Prisoner, Set 1",
      "The Prisoner, Set 2",
      "The Queen",
      "The Rise of the Silver Surfer (fullscreen)",
      "The Rise of the Silver Surfer (widescreen)",
      "The Robinsons: Lost in Space, Fan Film",
      "The Seven Dials Mystery",
      "The Simpsons Movie",
      "The Sittaford Mystery (Geraldine McEwan)",
      "The Sixth Sense",
      "The Still of the Night",
      "The Ten",
      "The Ten Commandments",
      "The Texas Chainsaw Massacre",
      "The Thin Man",
      "The Thing from Another World",
      "The Three Musketeers",
      "The Thunderbirds",
      "The Tick (animated), Season 1, Volume 1",
      "The Tick (animated), Season 1, Volume 2",
      "The Tick Collection: Seasons 1 through 3",
      "The Tick: The Entire Series!",
      "The Time Machine, 2002",
      "The Transporter",
      "The Transporter 2",
      "The Treasure of the Sierra Madre",
      "The Trouble with Harry",
      "The Ultimate Avengers",
      "The Ultimate Avengers 2",
      "The Usual Suspects",
      "The Venture Brothers, Season 1 Set (2 discs)",
      "The Venture Brothers, Season 1, Volume 1",
      "The Venture Brothers, Season 1, Volume 2",
      "The Venture Brothers, Season 1, Volume 3",
      "The Village of the Damned",
      "The War of the Worlds",
      "The War of the Worlds, 2005",
      "The Iron Giant",
      "The Man Who Knew Too Much, 1956",
      "The Man in the Iron Mask",
      "Them!",
      "They Do It With Mirrors, Joan Dickson",
      "This Island Earth",
      "Three Kings",
      "Thunderball",
      "The Wanderers, Disc 1",
      "The Wanderers, Disc 2",
      "The Wanderers, Disc 3",
      "The Wanderers, Disc 4",
      "Time Bandits",
      "Time Tunnel, Volume 1",
      "Time Tunnel, Volume 2",
      "Titan AE",
      "Titanic",
      "To Catch A Theif",
      "To Kill A Mockingbird",
      "Tommy and Tuppence, Set 1, Disc 1",
      "Tommy and Tuppence, Set 1, Disc 2",
  };

  protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    String term = request.getParameter("term");
    String result;
    if (term == null || term.length() == 0) {
      result = toJsonResponse(Arrays.asList(MOVIES));
    }
    else {
      result = toJsonResponse(filterMovies(term));
    }
    response.getWriter().write(result);
  }

  private List<String> filterMovies(String term) {
    List<String> result = new ArrayList<String>();
    for (String movie : MOVIES) {
      if (movie.startsWith(term)) result.add(movie);
    }
    return result;
  }

  private String toJsonResponse(List<String> strings) {
    StringBuilder json = new StringBuilder();
    json.append('[');
    boolean first = true;
    for (String string : strings) {
      json.append(first ? "" : ",").append('"').append(string).append('"');
      first = false;
    }
    json.append(']');
    return json.toString();
  }

}
